!function(){
    var loginFun = $('#loginFun'),headerZhang = $('.header-zhang'),headerMima = $('.header-mima'),useobj={}

    loginFun.on('click',function(){
        if (headerZhang.val() == '') {
            headerZhang.siblings('#zhangblack').fadeIn()
            return
        } else {
            headerZhang.siblings('#zhangblack').fadeOut()
        }
        if (headerMima.val() == '') {
            headerMima.siblings().fadeIn()
            return
        } else {
            headerMima.siblings().fadeOut()
        }
        useobj.name = headerZhang.val()
        useobj.key = headerMima.val()
        $.ajax({
            url:'http://localhost/80edu/login.php',
            method:'post',
            data:useobj,
            success:function(data){
                if(JSON.parse(data).success){
                    localStorage.setItem('user',data)
                    location.href = 'index.html'
                }else{
                    headerZhang.siblings('#zhangerror').fadeIn()
                }
            },
        })
    })
}()